package com.bchun.gamepk.dao.impl;

import java.io.Serializable;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.bchun.gamepk.dao.IBaseDao;

/**
 * <pre>
 * FutureSoftware
 * 
 * File: BaseDaoImpl.java
 * 
 * Copyright (C) By PeterFeng at 2013
 * 
 * Description: 
 * 
 * Notes:
 * 
 * Revision History
 * Date          Name         Desc
 * 2013年9月20日         PeterFeng    Initial design
 * 
 * </pre>
 */
public abstract class BaseDaoImpl<T> extends HibernateDaoSupport implements
		IBaseDao<T> {

	@Override
	public void delete(T model) throws DataAccessException {
		getHibernateTemplate().delete(model);
	}

	@Override
	public Object insert(T model) throws DataAccessException {
		return getHibernateTemplate().save(model);
	}

	@Override
	public T getById(Class<T> cls, Serializable id) {
		return (T) getHibernateTemplate().get(cls, id);
	}

	@Override
	public void update(T model) throws DataAccessException {
		getHibernateTemplate().update(model);
	}

}
